/* $Id: member.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/
#ifndef __MEMBER_H
#define __MEMBER_H

#include <map>

/// Member of a chat channel

class member {
	public:
	/// is this member correcly connected via de central server
	bool connected;
	/// alias of this member
	std::string name;
	/// password of this member
	std::string password;
	/// does this member block whispers
	bool whispers;
	/// what is the automatical answer to whisperers to this member
	std::string autoanswer;
	/// what is the world of this member (needed after login)
	class world *world;
	/// the time of the last message from this member
	///
	/// not more than one message each second please
	int last;
	/// the current selected channel
	class room* current;
	/// the other members that this member doesn't want to hear
	std::map<std::string,bool> ignore;
	/// how to reach this member
	class channel *ch;

	member(std::string membername="") {
	    connected=false;
		password="";
		whispers=true;
		autoanswer="";
	};
	std::string status(class room *r) {
		std::string res="";
		room_member m=r->members[name];
		switch(m.status) {
			case Status_muted:
				return "muted";
			case Status_member:
				if (r->silenced) return "silenced";
				return "member";
			case Status_moderator:
				return "moderator";
			case Status_leader:
				return "leader";
		}
		return "";
	}
};

#endif // __MEMBER_H
